package DBHandle;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.*;
import java.io.*;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;

public class FilterForSelect
{
	private InputStream inputStream;
	ResultSet rs=null;
	Statement stmt=null;
	String sql="";	
	DBConn.DBConnManager db=new DBConn.DBConnManager();
	DBHandle.General dbHandle=new General();
	Connection conn=db.getConnection("Mysql");
	
	
	public InputStream getInputStream() {
		return this.inputStream;
	}
	
	//获取商品类别列表
	@SuppressWarnings("deprecation")
	public String SelectProductCategory() throws Exception
	{
		ArrayList<String> temp=new ArrayList<String>();
		temp=dbHandle.SelectArrayList("name", "qbx_product_category");
		String contentString="";
		for(String item:temp)
			contentString+="<option>"+item+"</option>";
		inputStream=new StringBufferInputStream(contentString);
		return Action.SUCCESS;
	}
	
	//获取商品列表
	@SuppressWarnings("deprecation")
	public String SelectProduct() throws Exception
	{
		ArrayList<String> temp=new ArrayList<String>();
		temp=dbHandle.SelectArrayList("item", "qbx_product");
		String contentString="";
		for(String item:temp)
			contentString+="<option>"+item+"</option>";
		inputStream=new StringBufferInputStream(contentString);
		return Action.SUCCESS;
	}
	
	//获取商品购买地址列表
	@SuppressWarnings("deprecation")
	public String SelectPurchasePlace() throws Exception
	{
		ArrayList<String> temp=new ArrayList<String>();
		temp=dbHandle.SelectArrayList("place", "qbx_inventory");
		String contentString="";
		for(String item:temp)
			contentString+="<option>"+item+"</option>";
		inputStream=new StringBufferInputStream(contentString);
		return Action.SUCCESS;
	}
	
	//获取VM型号列表
	@SuppressWarnings("deprecation")
	public String SelectModel() throws Exception
	{
		ArrayList<String> temp=new ArrayList<String>();
		temp=dbHandle.SelectArrayList("name", "qbx_model");
		String contentString="";
		for(String item:temp)
			contentString+="<option>"+item+"</option>";
		inputStream=new StringBufferInputStream(contentString);
		return Action.SUCCESS;
	}
	
	//获取Venue Type 列表
	@SuppressWarnings("deprecation")
	public String SelectVenueType() throws Exception
	{
		ArrayList<String> temp=new ArrayList<String>();
		temp=dbHandle.SelectArrayList("name", "qbx_venue_type");
		String contentString="";
		for(String item:temp)
			contentString+="<option>"+item+"</option>";
		inputStream=new StringBufferInputStream(contentString);
		return Action.SUCCESS;
	}
	
	//获取城市列表
	@SuppressWarnings("deprecation")
	public String SelectCity() throws Exception
	{
		ArrayList<String> temp=new ArrayList<String>();
		temp=dbHandle.SelectArrayList("city", "qbx_region");
		String contentString="";
		for(String item:temp)
			contentString+="<option>"+item+"</option>";
		inputStream=new StringBufferInputStream(contentString);
		return Action.SUCCESS;
	}
	
	//获取Region列表
	@SuppressWarnings("deprecation")
	public String SelectRegion() throws Exception
	{
		ArrayList<String> temp=new ArrayList<String>();
		temp=dbHandle.SelectArrayList("region", "qbx_region");
		String contentString="";
		for(String item:temp)
			contentString+="<option>"+item+"</option>";
		inputStream=new StringBufferInputStream(contentString);
		return Action.SUCCESS;
	}
	
	//获取Venue Code列表
	@SuppressWarnings("deprecation")
	public String SelectVenueCode() throws Exception
	{
		ArrayList<String> temp=new ArrayList<String>();
		temp=dbHandle.SelectArrayList("venue_code", "qbx_vm");
		String contentString="";
		for(String item:temp)
			contentString+="<option>"+item+"</option>";
		inputStream=new StringBufferInputStream(contentString);
		return Action.SUCCESS;
	}
}